{% extends 'my_center_base.html' %}
<title xmlns="http://www.w3.org/1999/html">{% block title %}地址管理{% endblock %}</title>

{% block js_css %}
<script type="text/javascript">
        let addresses = {{ addresses | safe }};
        var default_address_id = "{{ default_address_id }}";
</script>

{% endblock %}

{% block idea %}
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="{{ url('index:index') }}" class="fl">首页</a>
				<span>/</span>
				<a href="{{ url('users:my_center') }}">个人中心</a>
				<span>/</span>
				<a href="{{ url('users:address') }}" class="on">地址管理</a>
			</div>
		</div>
{% endblock %}
		<!------------------------------Bott------------------------------>

{% block li %}
    <div>
						<h4>我的交易</h4>
						<ul>
							<li><a href="{{ url('shoppingcart:carts')}}">我的购物车</a></li>
							<li><a href="{{ url('users:myorderq',kwargs={"page_num":1}) }}">我的订单</a></li>

						</ul>
						<h4>个人中心</h4>
						<ul>
							<li><a href="{{ url('users:my_center')}}">我的中心</a></li>
							<li class="on"><a href="{{ url('users:address')}}">地址管理</a></li>
						</ul>
						<h4>账户管理</h4>
						<ul>
							<li><a href="{{ url('users:my_mygrxx')}}">个人信息</a></li>
							<li><a href="{{ url('users:password')}}">修改密码</a></li>
						</ul>
	</div>
{% endblock %}

{% block bott %}
		<div class="you fl">
					<h2>收货地址</h2>
					<div class="add">
						<div>
							<a href="#2" id="addxad"><img src="/static/img/jia.png"/></a>
							<span>添加新地址</span>
						</div>

                        {% for addre in address %}
                            {% if addre.is_deleted == 1 and addre %}

                            {% else %}
                            <div id="dizhi">
                                <p>收货人：{{ addre.receiver }}</p>
                                <p>手机号：{{ addre.mobile }}</p>
                                <p>地址：{{ addre.place }}</p>
                                <p>详细地址：{{ addre.detail_address }}（063000）</p>
                                <br>

                                <p><a id="readd">修改</a>
                                <a href="/del_address/?id={{ addre.id }}">删除</a></p>
                            </div>
                             {% endif %}
                        {% endfor %}

					</div>
				</div>
		<!--编辑弹框-->
		<!--遮罩-->
		<div class="mask"></div>
         <div class="adddz">
			<form action="/address/" method="post">
				<input type="text" name="username" placeholder="姓名" class="on" />
				<input type="tel" name="mobile" placeholder="手机号" />
				<div class="city">
				<input type="text" name="address" placeholder="请输入省市区">
				</div>
				<textarea name="detail" rows="" cols="" placeholder="详细地址"></textarea>


				<input type="text" name="portcode" placeholder="邮政编码" />
				<div class="bc">
					<input type="submit" value="保存" />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
		<div class="readd">
			<form action="/del_address/" method="post">
				<input type="text" name="username" placeholder="请输入姓名" class="on" />
				<input type="tel" name="mobile" placeholder="请输入手机号" />
				<div class="city">
				<input type="text" name="address" placeholder="请输入省市区">
				</div>
				<textarea name="detail" rows="" cols="" placeholder="请输入详细地址"></textarea>


				<input type="text" name="portcode" placeholder="请输入邮政编码" />
				<div class="bc">
					<input type="submit" value="保存" />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
{% endblock %}

{#<script>#}
{#    $(#addss).click(function () {#}
{#        $.ajax({#}
{#            url: /address/,#}
{#            type: post,#}
{#            data:{#}
{#                username:username,#}
{#                #}
{#            }#}
{#        })#}
{#    })#}
{#</script>#}

{% block script %}
    {% if messages %}
        <script>
        {% for msg in messages %}
            alert('{{ msg.message }}');
        {% endfor %}
        </script>
    {% endif %}
{% endblock %}
<script type="text/javascript">
    let username = "{{ username }}";
    let user_image = "{{ user_image }}";
</script>

